package cn.eu.system.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.eu.common.base.controller.EuBaseController;
import cn.eu.common.model.ResultBody;
import cn.eu.common.query.MpJoinQueryHelper;
import cn.eu.system.domain.SysUser;
import cn.eu.system.mapper.SysUserMapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springdoc.api.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/api/test")
@RestController
public class TestController extends EuBaseController {

    @Autowired
    private SysUserMapper sysUserMapper;

    @SaIgnore
    @GetMapping("query")
    public ResultBody query(@ParameterObject TestCriteria criteria) {
        MPJLambdaWrapper<SysUser> wrapper = MpJoinQueryHelper.buildQueryWrapper(criteria);
        sysUserMapper.selectJoinList(SysUser.class, wrapper.distinct());
        return ResultBody.ok();
    }
}
